#! /bin/bash
CODE_BASE_DIR=/root/code/mate-cloud
DEPLOY_BASE_DIR=/usr/local/deploy/mate-cloud

export JAVA="$JAVA_HOME/bin/java"
echo $0
appName=$0
appName=${appName%.*}


pkill -f ${appName}.jar

JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${DEPLOY_BASE_DIR}/logs/java_heapdump_${appName}.hprof"
JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages"

JAVA_OPT="${JAVA_OPT} -jar ${CODE_BASE_DIR}/${appName}/target/${appName}.jar --spring.profiles.active=test"
echo "----java run args--------"
echo $JAVA_OPT
echo "----java run args--------"
nohup $JAVA     ${JAVA_OPT} >${DEPLOY_BASE_DIR}/logs/${appName}_out.txt &

